#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
	
int main(int argc,char *argv[]){

	
	pid_t pid;
	int signum;

	if(argc != 3){
		
		printf("Error!\n");
		exit(-1);
	}
	
	signum = atoi(argv[1]);
	pid = atoi(argv[2]);

	int usr1 = 666;
	int usr2 = 555;

	printf("send pid = %d\n",getpid());

	union sigval val1;
	union sigval val2;

	 /*union sigval {
        int   sival_int;
        void *sival_ptr;
         };*/
	val1.sival_int = usr1;
	val2.sival_int = usr2;

//       int sigqueue(pid_t pid, int sig, const union sigval value);
	if(sigqueue(pid,SIGUSR1,val1) != -1){
		
		printf("user1 send data = %d\n",usr1);
	}
	
	if(sigqueue(pid,SIGUSR2,val2) != -1){
		
		printf("user2 send data = %d\n",usr2);
	}

	return 0;
}
